﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZLDC.Common.Estate;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ZLDC.Topo.BLL.Estate
{
    public class lp_today_list
    {
        public static string getUserList(string sql)
        {
            DataSet ds = ZLDC.Topo.BLL.Estate.lp_Basis.Getds(sql);
            string list = "";
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                list += ds.Tables[0].Rows[i]["userID"].ToString()+",";
            }
                return list;
        }

                                                public static string geta_Average(string sqlwhere)
        {
            DataSet ds = ZLDC.Topo.BLL.Estate.lp_Basis.Getds("select SUM(Actual_Goal) as Actual_Goal,COUNT(1) as count  from v_lp_mainlist as vm  " +sqlwhere+" and workday='"+DateTime.Now.ToString("yyyy-MM-dd")+"'");
            if(ds.Tables.Count>0)
            if (ds.Tables[0].Rows.Count > 0)
            {
                return Gethtml(ds.Tables[0].Rows[0]["Actual_Goal"].ToString(), ds.Tables[0].Rows[0]["count"].ToString());
            }
            return "";
        }

        public static string Gethtml(string Actual_Goal,string count)
        {
            return "人均得分："+Math.Round((Convert.ToDecimal(Actual_Goal == "" ? "0" : Actual_Goal)/Convert.ToDecimal(count)),2);
        }
    }
}
